<?php

/**
 * members actions.
 *
 * @package    skiline
 * @subpackage members
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class membersActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->forward('default', 'module');
  }

  public function executeRegister(sfWebRequest $request)
  {
    $this->msg = $request->getParameter('register');
    $this->form = new RegistrationForm();
    if (!$request->isMethod('post'))
    {
      $this->msg = 'not post';
      return 'Success';
    }
    else
    {
      $this->form->bind($request->getParameter('register'));

      if ($this->form->isValid())
      {
        $register = $this->form->getValues();
        $em = $this->getEntityManager();
        $user = new \Model\User();
        $user->setFirstName($register['firstname']);
        $user->setLastName($register['lastname']);
        $user->setEmail($register['$email']);
        $user->setSalt(substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 5)), 0, 5));
        $user->setPassword($register['password']);
        echo $register['birthdate'];
        

      }
      else
      {
        
        return 'Success';
      }
    }
  }
}
